<%--
  User: Shengzhao Li
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>日志类型表单</title>

</head>
<body>

<div id="log_type_form_page" data-role="dialog">
    <div data-role="header" data-theme="f">
        <h1>日志类型表单</h1>
    </div>
    <div data-role="content">
        <form:form commandName="logType" id="log_type_form" data-ajax="false" onsubmit="return validateForm(this);">
            <ul data-role="listview">
                <li>
                    <div data-role="fieldcontain">
                        <label for="name">名称:</label>
                        <form:input path="name" id="name" placeholder="日志类型名称"/>
                        <form:errors path="name" cssClass="form_error"/>
                        <span id="name_error" style="display: none;" class="form_error">名称不能为空</span>
                    </div>
                    <div data-role="fieldcontain">
                        <label for="description">描述:</label>
                        <form:textarea path="description" id="description" placeholder="描述你的日志类型"/>
                    </div>
                    <div data-role="fieldcontain">
                        <button type="submit" data-theme="b">保存</button>
                        <a href="javascript:void(0);" data-role="button" data-rel="back">取消</a>
                    </div>
                </li>
            </ul>
        </form:form>
    </div>
    <script type="text/javascript">
        function validateForm(form) {
            var result = true;
            var $name = $(form).find("#name");
            if ($.trim($name.val()) == '') {
                $("#name_error").show();
                result = false;
            }
            return result;
        }
    </script>
</div>
</body>
</html>